$val) { if (__('Bungalovlar', 'bungalovlar') == $val[0]) { $menu[$key][6] = 'dashicons-store'; } } } add_action('admin_menu', 'trwp_default_post_type_icon'); // Sayfalama function sayfalama($pages = '', $range = 2) { $showitems = ($range * 2) + 1; global $paged; if (empty($paged)) { $paged = 1; } if ($pages == '') { global $wp_query; $pages = $wp_query->max_num_pages; if (!$pages) { $pages = 1; } } if (1 != $pages) { echo '"; } } // Arşive Arama Sonuçları function tr_wp_post_limit_archive_pages($query) { if (is_admin() || !$query->is_main_query()) { return; } if (is_post_type_archive('blog')) { $query->set('posts_per_page', 1); } } add_filter('pre_get_posts', 'tr_wp_post_limit_archive_pages'); // Bölgeler function register_taxonomy_bolge() { register_taxonomy( 'bolge', 'post', [ 'label' => __('Bölge'), 'hierarchical' => true, 'show_admin_column' => true, ] ); } add_action('init', 'register_taxonomy_bolge'); // Özellikler function register_taxonomy_ozellik() { register_taxonomy( 'ozellik', 'post', [ 'label' => __('Özellik'), 'hierarchical' => false, 'show_admin_column' => true, ] ); } add_action('init', 'register_taxonomy_ozellik'); // Adminbar Sil add_action('after_setup_theme', 'all_user_remove_admin_bar'); function all_user_remove_admin_bar($adminbarsilinsinmi) { if (!current_user_can('administrator') && !is_admin()) { show_admin_bar(false); } } // Geri Dön Fonksiyonu function get_back_page() { $previous = "javascript:history.go(-1)"; if (isset($_SERVER['HTTP_REFERER'])) { $previous = $_SERVER['HTTP_REFERER']; } return $previous; } // Taxonomy Listele function get_tax_list($taxname) { $args = [ 'style' => 'none', 'separator' => '', 'show_count' => 0, 'child_of' => 0, 'title_li' => __(''), 'taxonomy' => $taxname, ]; wp_list_categories($args); } /* Kullanıcı Gerçek IP Alma */ if (!is_user_id()) { function GetIP() { if (getenv("HTTP_CLIENT_IP")) { $ip = getenv("HTTP_CLIENT_IP"); } elseif (getenv("HTTP_X_FORWARDED_FOR")) { $ip = getenv("HTTP_X_FORWARDED_FOR"); if (strstr($ip, ',')) { $tmp = explode(',', $ip); $ip = trim($tmp[0]); } } else { $ip = getenv("REMOTE_ADDR"); } return $ip; } function trwp_kullanici_giris_ip($user_login, $user) { $loginipsi = GetIP(); update_user_meta($user->ID, 'login_ip', $loginipsi); } add_action('wp_login', 'trwp_kullanici_giris_ip', 10, 2); } // Comment Count By User function commentCount() { global $wpdb, $current_user; get_currentuserinfo(); $userId = $current_user->ID; $count = $wpdb->get_var('SELECT COUNT(comment_ID) FROM ' . $wpdb->comments . ' WHERE user_id = "' . $userId . '"'); return $count; } // Özel yorum şablonu. function tr_wp_yorum_sablonu($comment, $args, $depth) { $GLOBALS['comment'] = $comment; $comment_title = get_comment_meta($comment->comment_ID, 'comment_title', true); $konum = get_comment_meta($comment->comment_ID, 'konum', true); $temizlik = get_comment_meta($comment->comment_ID, 'temizlik', true); $hizmet = get_comment_meta($comment->comment_ID, 'hizmet', true); $havuz = get_comment_meta($comment->comment_ID, 'havuz', true); $konfor = get_comment_meta($comment->comment_ID, 'konfor', true); $performans = get_comment_meta($comment->comment_ID, 'performans', true); ?>
    • Konum:
      Temizlik:
      Hizmet:
      Havuz/Jakuzi:
      Konfor:
      Fiyat/Performans:
  • prefix . 'comments'; $commentsmeta_table = $wpdb->prefix . 'commentmeta'; $get_post_comments = $wpdb->get_results("SELECT * FROM $comments_table WHERE comment_post_ID='$post_id'", OBJECT); $ratings_array = []; foreach ($get_post_comments as $comment) { $query_reaction = $wpdb->get_results( "SELECT * FROM $commentsmeta_table WHERE `comment_id`='$comment->comment_ID' AND `meta_key`='konum'", OBJECT ); foreach ($query_reaction as $reaction) { if (!empty($reaction->meta_value)) { $ratings_array[] = $reaction->meta_value; } } } if (count($ratings_array) > 0) { $average = array_sum($ratings_array) / count($ratings_array); $rating = round($average); echo '
    '; } else { echo '
    '; } } // Kullanıcılar sayfasına eklemeler. $mt8_sulbpc = new Mt8_Sort_User_List_By_Post_Counts(); $mt8_sulbpc->register_hooks(); class Mt8_Sort_User_List_By_Post_Counts { const TEXT_DOMAIN = 'mt8-sort-user-list-by-post-counts'; public function register_hooks() { add_filter('manage_users_sortable_columns', [&$this, 'manage_users_sortable_columns']); } public function manage_users_sortable_columns($sortable_columns) { if (!array_key_exists('posts', $sortable_columns)) { $sortable_columns['posts'] = 'post_count'; } return $sortable_columns; } } // Count Rez function rez_count($status, $userid) { global $wpdb; $count = $wpdb->get_var( $wpdb->prepare( " SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'rezervasyonlar' AND post_author = %d AND post_status = %s ", $userid, $status ) ); return $count; } // Sahre (Paylaş) function share() { $adresss = 'https://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; $trwpshareURL = urlencode(get_permalink()); $trwpshareBTNtitle = get_the_title(); ?>
    Paylaş Tweet'le Pin'le Gönder Gönder E-posta
    $fiyat) { if (empty($fiyat) && preg_match('/\d{4}-\d{2}-\d{2}/', $tarih)) { $dolu_tarihler[] = "'" . $tarih . "'"; } $odax = $oda['oda_adi']; } } } if (empty($dolu_tarihler)) { return ''; // eşleşen oda yoksa boş değer döndür } $dolu_tarihler_cikti = '[' . implode(',', $dolu_tarihler) . ']'; $dolu_tarihler_cikti = str_replace('"', '', $dolu_tarihler_cikti); $dolu_tarihler_cikti = str_replace("'oda_adi',", "", $dolu_tarihler_cikti); return $dolu_tarihler_cikti; } // Boş odalar Json function bos_json() { global $wpdb, $post_id; $get_fiyatlar = get_post_meta($post_id, 'fiyatlar', $fiyatlar); $get_fiyatlar = $get_fiyatlar[0]; $bos_tarihler = []; foreach ($get_fiyatlar as $bos_tarih => $bos_fiyat) { if (!empty($bos_fiyat)) { // $bos_tarih[] = ' - ' . $bos_fiyat . ''; $bos_tarihler[] = $bos_tarih . $bos_fiyat; } } } // Son tarih kontrol function son_tarih() { global $wpdb, $post_id; $get_fiyatlar = get_post_meta($post_id, 'fiyatlar', true); $last_date = ''; $last_price = ''; foreach ($get_fiyatlar as $date => $price) { if (!empty($price)) { $last_date = $date; $last_price = $price; } } $last_date_convert = date('d-m-Y', strtotime($last_date)); echo $last_date_convert; } // Kullanıcı rollerini kontrol etme function check_user_role() { if (!is_user_logged_in() || (!current_user_can('admin') && !current_user_can('firma'))) { // wp_redirect(get_permalink(yoka('page_giris'))); // exit; header("Location: " . esc_url(get_permalink(yoka('page_giris'))) . ""); } } // Session start function sess_start() { if (!session_id()) session_start(); } add_action('init','sess_start'); // Telefon formatlama function format_telefon($telefon) { if (substr($telefon, 0, 1) !== '0') { $telefon = '0' . $telefon; } switch (strlen($telefon)) { case 10: $telefon = '90' . $telefon; break; case 11: $telefon = '9' . $telefon; break; default: break; } return $telefon; } // Rezervasyon ID Temizleme function getRezId($rez_id) { $rez_id = explode("-", $rez_id); if (isset($rez_id[1])) { $rez_id = $rez_id[1]; return $rez_id; } }